import 'package:safetymonitor/generated/json/base/json_field.dart';
import 'package:safetymonitor/generated/json/device_tree_entity.g.dart';
import 'dart:convert';
export 'package:safetymonitor/generated/json/device_tree_entity.g.dart';

@JsonSerializable()
class DeviceTreeEntity {
  DeviceTreeEntity();

  factory DeviceTreeEntity.fromJson(Map<String, dynamic> json) => $DeviceTreeEntityFromJson(json);
  int? id = 0;
  String? label = '';
  List<DeviceTreeChildren>? children = [];
  String? code = '';
  int? sort;
  int? parentId = 0;

  Map<String, dynamic> toJson() => $DeviceTreeEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class DeviceTreeChildren {
  DeviceTreeChildren({this.id, this.label, this.code, this.sort, this.parentId});

  factory DeviceTreeChildren.fromJson(Map<String, dynamic> json) => $DeviceTreeChildrenFromJson(json);
  int? id = 0;
  String? label = '';
  String? code = '';
  int? sort = 0;
  int? parentId = 0;

  Map<String, dynamic> toJson() => $DeviceTreeChildrenToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
